<?PHP
/*
 * $Id: FormAction.class.php 162 2009-12-16 16:03:27Z namba0219 $
 * =============================================================================
 * Barge - Web application framework on PHP5
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * =============================================================================
 * For more information, see http://barge.googlecode.com/
 */
namespace examples\actions;

use barge\System;
use barge\io\File;
use barge\utils\ArrayList;
use barge\utils\HashMap;
use barge\utils\FileUtils;
use barge\utils\OutputBuffer;
use barge\utils\String;
use barge\utils\Timestamp;
use barge\web\ActionContext;
use barge\web\DispatchAction;
use barge\web\Request;
use barge\web\Response;
use barge\web\Messages;
use barge\web\Message;
use barge\web\Validator;



/**
 *
 * @version 1.0 2009/01/24
 * @author Kenji Namba
 * @see DispatchAction
 */
class FormAction extends DispatchAction
{
	/**
	 * @param ActionContext $context
	 * @see Action#execute
	 */
	public function init(ActionContext $context)
	{
		// Note : この処理を行うことで内部でフォームが作成される
		$form = $context->getForm(false);

		$session = $context->getRequest()->getSession();
		$session->setAttribute('options', $this->createOptions());

		$context->render();
	}

	/**
	 * @return HashMap
	 */
	protected function createOptions()
	{
		$options = new HashMap();
		$options->put('1', 'ＩＴ・サービス業');
		$options->put('2', '製造業');
//		$options->put('3', '製造業');
		return $options;
	}

	/**
	 * @return HashMap
	 */
	protected function createEnquates()
	{
		$enquates = new ArrayList();
//		$map = new HashMap();
//		$map->put('text', '何で知りましたか？');
//		$map->put('2', '製造業');
////		$options->put('3', '製造業');
		return $enquates;
	}

	/**
	 * @return ArrayList
	 */
	protected function getMethods()
	{
		return new ArrayList();
	}

}
